<!-- 应聘库 -->
<template>
  <div class="rthcHead">
    <div class="rthcImg">
      <img src="@/assets/img/personnelImage/岗位需求库.png">
      <span class="rthcTi" title="应聘库">应聘库</span>
    </div>
    <div class="rthc-handle">
      <span class="rthc-handle-pri">
        <el-button type="primary" @click="this.$router.push({path:'/aperi'})">新建简历</el-button>
      </span>
      <span class="rthc-handle-more">
        <el-dropdown trigger="click">
        <span class="el-dropdown-link">
          <el-icon>
            <setting/>
        </el-icon>
        </span>
       <template v-slot:dropdown>
         <el-dropdown-menu>
           <el-dropdown-item icon="el-icon-plus" @click="apilink">新建</el-dropdown-item>
           <el-dropdown-item icon="el-icon-circle-plus-outline" @click="Enotifi">邮件通知</el-dropdown-item>
           <el-dropdown-item icon="el-icon-check" @click="rejectOp">删除</el-dropdown-item>
         </el-dropdown-menu>
       </template>
    </el-dropdown>
      </span>
    </div>
  </div>
  <div style="height: 100%; min-height: 235px;">
    <div class="rthc-list-table">
      <el-table
          ref="multipleTable"
          :data="tableData"
          tooltip-effect="dark"
          style="width: 100%"
          :header-cell-style="{background:'#F7FBFE',color:'#606266'}"
          @selection-change="handleSelectionChange">
        <el-table-column
            prop="id"
            type="selection"
            :selectable="selectableStatus"
            width="55">
        </el-table-column>
        <el-table-column
            prop="name"
            label="应聘人姓名"
            width="120">
        </el-table-column>
        <el-table-column
            prop="resumeClassify.positionName"
            label=应聘岗位
            width="140">
        </el-table-column>
        <el-table-column
            prop="major"
            label=所学专业
            width="140">
        </el-table-column>
        <el-table-column
            prop="sex"
            label="性别"
            width="75"
            show-overflow-tooltip>
          <template #default="xx">
            <el-tag type="warning" v-if="xx.row.sex === 0">男</el-tag>
            <el-tag type="success" v-else-if="xx.row.sex === 1">女</el-tag>
          </template>
        </el-table-column>
        <el-table-column
            prop="createTime"
            label="应聘日期"
            width="180"
            show-overflow-tooltip>
          <template #default="socp">
            {{socp.row.createTime}}
          </template>
        </el-table-column>
        <el-table-column
            prop="status"
            label="应聘状态"
            show-overflow-tooltip>
          <template #default="xx">
            <el-tag type="warning" v-if="xx.row.status === 0">已录入</el-tag>
            <el-tag type="success" v-else-if="xx.row.status === 1">未录入</el-tag>
            <el-tag type="success" v-else-if="xx.row.status === 2">未通过</el-tag>
          </template>
        </el-table-column>
        <el-table-column
            prop="status"
            label="是否已通知"
            width="150px"
            show-overflow-tooltip>
          <template #default="xx">
            <el-tag type="warning" v-if="xx.row.status === 0">是</el-tag>
            <el-tag type="success" v-else-if="xx.row.status === 1">否</el-tag>
            <el-tag v-else-if="xx.row.status === 2">未通过</el-tag>
          </template>
        </el-table-column>
      </el-table>
      <div class="pag-block" style="">
        <el-pagination
            v-if="pageShow"
            @current-change="handleCurrentChange"
            :total="paging.total"
            :page-size="paging.pageSize"
            :hide-on-single-page="hidePaging"
        >
        </el-pagination>
      </div>
    </div>
    <div class="pag-block" style="">
      <el-pagination
          @current-change="handleCurrentChange"
          @next-click="handleCurrentChange"
          @prev-click="handleCurrentChange"
          :total="paging.total"
          :page-size="paging.pageSize"
          :hide-on-single-page="hidePaging"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import {batchSend, rejectOp, selAll} from '../../../network/per/inter'
export default {
  data() {
    return {
      // 无条件分页
      paging:{
        pageNum: 1,
        pageSize: 10,
        total: null,
      },
      hidePaging: false,
      activeNames: [],
      // 展示表数据
      tableData: [],
      // 选中表数据
      multipleSelection: [],
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {
    this.init();
  },
  methods: {
    init(){
      selAll(this.paging).then((des)=>{
        console.log("atl->初始化 ",des)
        this.tableData = des.data.list;
        this.paging.total = des.data.total;
        this.paging.pageSize = des.data.pageSize;
        this.paging.pageNum = des.data.pageNum;
      })
    },
    apilink(){
      window.open("/atlzp");
    },
    selectableStatus:function (row,index){
      if (row.status === 0){
        return true;
      }
    },
    resetForm() {
      this.$refs['vForm'].resetFields()
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.paging.pageNum = val;
      this.init();
    },
    handleSelectionChange(val) {
      this.multipleSelection = []
      for (let i = 0; i < val.length; i++) {
        this.multipleSelection.push(val[i].id)
      }
    },
    Enotifi(){
      batchSend(this.multipleSelection).then((das)=>{
        if (das.code === 200) {
          this.$notify({
            title: '成功',
            message: '这是一条成功的提示消息',
            type: 'success'
          })
        }else {
          this.$notify({
            title: '失败',
            message: '这是一条失败的提示消息',
            type: 'error'
          })
        }

      })
    },
    rejectOp(){
      rejectOp(this.multipleSelection).then((das)=>{
        if (das != null) {
          this.$notify({
            title: '成功',
            message: '这是一条成功的提示消息',
            type: 'success'
          })
        }else {
          this.$notify({
            title: '失败',
            message: '这是一条失败的提示消息',
            type: 'error'
          })
        }

      })
    },
  }
}
</script>

<style lang="scss" scoped>
@import "../../../assets/css/personnelCss/RecruitHeadcount";
.el-input-number.full-width-input,
.el-cascader.full-width-input {
  width: 100% !important;
}

.el-form-item--medium {
  .el-radio {
    line-height: 36px !important;
  }

  .el-rate {
    margin-top: 8px;
  }
}

.el-form-item--small {
  .el-radio {
    line-height: 32px !important;
  }

  .el-rate {
    margin-top: 6px;
  }
}

.el-form-item--mini {
  .el-radio {
    line-height: 28px !important;
  }

  .el-rate {
    margin-top: 4px;
  }
}

.clear-fix:before,
.clear-fix:after {
  display: table;
  content: "";
}

.clear-fix:after {
  clear: both;
}

.float-right {
  float: right;
}

</style>

<style lang="scss" scoped>
                   div.table-container {
                     table.table-layout {
                       width: 100%;
                       table-layout: fixed;
                       border-collapse: collapse;

                       td.table-cell {
                         display: table-cell;
                         height: 36px;
                         border: 1px solid #e1e2e3;
                       }
                     }
                   }

div.tab-container {}

.label-left-align ::v-deep .el-form-item__label {
  text-align: left;
}

.label-center-align ::v-deep .el-form-item__label {
  text-align: center;
}

.label-right-align ::v-deep .el-form-item__label {
  text-align: right;
}

.custom-label {}

.static-content-item {
  min-height: 20px;
  display: flex;
  align-items: center;

  ::v-deep .el-divider--horizontal {
    margin: 0;
  }
}

</style>